<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>test API</title>
</head>
<body>
    <div id="app"></div>

    <script>
        var xhr = new XMLHttpRequest();
        xhr.open('POST', 'http://127.0.0.1:1234', true);

        xhr.onreadystatechange = function() {
            console.log(xhr.readyState, xhr.status);

            if (xhr.readyState === 4 && xhr.status === 200) {
                console.log(xhr.response + ' __from__ ' + xhr.responseURL);
            }
        };

        xhr.send('/view');
    </script>
    <script src="../src/data.js"></script>
</body>
</html>